/*
 * typedef.h
 *
 *  Created on: Nov 13, 2021
 *      Author: Jinming
 */

#ifndef INC_TYPEDEF_H_
#define INC_TYPEDEF_H_

#include "main.h"

#ifndef UINT8
#define UINT8	uint8_t
#endif

#ifndef INT8
#define INT8	int8_t
#endif

#ifndef UINT16
#define UINT16	uint16_t
#endif

#ifndef INT16
#define INT16	int16_t
#endif

#ifndef UINT32
#define UINT32	uint32_t
#endif

#ifndef INT32
#define INT32	int32_t
#endif

#ifndef BOOL
#define BOOL	uint8_t
#endif

#ifndef FALSE
#define FALSE	0
#endif

#ifndef TRUE
#define TRUE	1
#endif

#define PI	3.141592654f
#define PI2	6.283185308f

#define VALUE_INC(x,y)		{x++; x = (x >= y) ? 0 : x;}
#define VALUE_SUB(x,y,z,a)		{a = (x <= y) ? (y-x) : (z-x+y);}

#define JOINT_NUM		4

#define SELF_CAN_ID		0xA5

typedef enum
{
	JOINT_LEFT = 0,
	JOINT_RIGHT,

	JOINT_LIMIT,
}JOINT_LIST_e;

typedef struct
{
    int32_t p_des;
    int32_t v_des;
    int32_t a_des;
    int32_t kp_des;
    int32_t ki_des;
    int32_t kd_des;
    int32_t tff_des;
    uint16_t type;   // CAN_PACKET_ID，canopen发送时canid=packagetype_des-1
}JointCtrl_t;

typedef struct
{
	int16_t x;
	int16_t y;
	int16_t z;
}PlantarInfo_t;

typedef struct
{
	int32_t force[6];
	PlantarInfo_t plantarL[4];
	PlantarInfo_t plantarR[4];
	int32_t reserve[2];
}LegSensor_t;


#endif /* INC_TYPEDEF_H_ */
